package api

import (
	"fmt"
	"gin_demo01/pkg/gredis"
	"gin_demo01/pkg/logging"

	"github.com/gin-gonic/gin"
)

func SetCache(c *gin.Context) {
	fmt.Println("cache start")
	key := "taglist"
	if gredis.Exists(key) {

		fmt.Println("cache存在")
		data, err := gredis.Get(key)
		if err != nil {
			logging.Info(err)
		} else {
			logging.Info(data)
		}
		return
	}

	fmt.Println("cache不存在")
	gredis.Set(key, "golan", 3600)

}
